package com.mediacloud.app.newsmodule.activity;


import android.os.Bundle;
import android.text.TextUtils;

import androidx.fragment.app.FragmentTransaction;

import com.mediacloud.app.newsmodule.R;
import com.mediacloud.app.newsmodule.adaptor.NewsListItemStyleAdaptor;
import com.mediacloud.app.newsmodule.fragment.newslist.NewsListWidthBannerFragment;
import com.mediacloud.app.model.activity.BaseBackActivity;
import com.mediacloud.app.model.news.CatalogItem;
/**
 * 新闻列表  某个栏目的
 * 
 *
 */
public class NewsListActivity extends BaseBackActivity 
{


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		CatalogItem catalogItem=getIntent().getParcelableExtra("catalog");
		NewsListWidthBannerFragment fragment=new NewsListWidthBannerFragment();
		fragment.setAdaptor(new NewsListItemStyleAdaptor(this,catalogItem));
		Bundle bundle=new Bundle();
		bundle.putParcelable("catalog", catalogItem);
		if(catalogItem!=null&&!TextUtils.isEmpty(catalogItem.getCatid())){
			bundle.putString("id", catalogItem.getCatid());
		}
		fragment.setArguments(bundle);
		FragmentTransaction transaction=getSupportFragmentManager().beginTransaction();
		transaction.replace(R.id.newsContentFragment, fragment);
		transaction.show(fragment);
		transaction.commitNowAllowingStateLoss();
		if(catalogItem!=null&&!TextUtils.isEmpty(catalogItem.getCatname())){
			setTitle(catalogItem.getCatname());
		}
	}

	@Override
	public int getLayoutResID() {
		return R.layout.aappfactory_newslistactivity;
	}
}